package com.ynny.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.ynny.blockhandler.HotspotBlockHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
// 热点规则,需要带参数
@RestController
public class HotspotController {
    @GetMapping("/hotspot")
    @SentinelResource(value = "getHotspotResource", blockHandler = "getHotspotBlockHandler",
            blockHandlerClass = HotspotBlockHandler.class)

    //@RequestParam的作用: 将参数绑定到方法参数中, required = false表示参数必要否
    public String getHotspot(@RequestParam(value = "type",required = false)String type,
                             @RequestParam(value = "name",required = false)String name
                             ) {
        return "进入热点";
    }

}